package com.sell.shop;



/**
 * @author duxiaotong
 */
public class ConsuA implements SailSumMoney {


    @Override
    public int sailMoney(Integer appleNum, Integer stbNum, Integer mangGuoNum, boolean biaozhi) {
        //
        Shop shop = new Shop(biaozhi);

        Integer apple = shop.getApple();
        Integer stb = shop.getStb();
        Integer mangGuo = shop.getMangGuo();

        Integer sum01 = appleNum*apple;
        Integer sum02 = stb * stbNum;

        boolean daZhe = shop.getDaZhe();

        if(daZhe){
            double sum03= (mangGuo*mangGuoNum)*0.8;
            int sum = sum(sum01, sum02, (int) sum03);
            if(sum>=100){
                return  descBy10(sum);
            }else {
                return sum;
            }
        }else {
            Integer sum03= mangGuo*mangGuoNum;
            return  sum(sum01,sum02,sum03);
        }

    }


    private int sum (Integer a,Integer b, Integer c){
        return a+b+c;


    }

    private Integer descBy10(Integer desc){

        return desc -10;
    }


}
